package main.module.castle
{
	import com.adobe.fileformats.vcard.Address;
	import com.standlibrary.debug.Debug;
	import com.standlibrary.global.Global;
	import com.standlibrary.load.GetObject;
	import com.standlibrary.ui.base.BaseSprite;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;

	/**
	 * 城堡
	 */
	public class InnerSence extends BaseSprite
	{
		
		private var mainMC:MovieClip;
		
		public function InnerSence()
		{
			
			mainMC = GetObject.getMC("InnerBack");
			addChild(mainMC);
			
			mainMC.shootBt.addEventListener(MouseEvent.CLICK, senceModule);
			mainMC.academyBt.addEventListener(MouseEvent.CLICK, senceModule);
			mainMC.oreBt.addEventListener(MouseEvent.CLICK, senceModule);
			mainMC.shopBt.addEventListener(MouseEvent.CLICK, senceModule);
			mainMC.peopleBt.addEventListener(MouseEvent.CLICK, senceModule);
			
			this.addEventListener(MouseEvent.MOUSE_DOWN, beginDrag);
		}
		
		private function senceModule(eve:MouseEvent):void
		{
			var nameStr:String = eve.target.name;
			switch(nameStr)
			{
				case "shootBt":
					break;
				case "academyBt":
					break;
				case "oreBt":
					break;
				case "shopBt":
					break;
				case "peopleBt":
					break;
			}
			Debug.log(nameStr);
		}
		
		private function beginDrag(eve:MouseEvent):void
		{
			var w:int = this.width - Global.STAGE_WIDTH;
			var h:int = this.height - Global.STAGE_HEIGHT;
			
			this.startDrag(false, new Rectangle(-w, -h, w, h));
			stage.addEventListener(MouseEvent.MOUSE_UP, dragEnd, false, 0, true);
		}
		
		private function dragEnd(eve:MouseEvent):void
		{
			stopDrag();
			stage.removeEventListener(MouseEvent.MOUSE_UP, dragEnd);
		}
	}
}